use std::env; // for env::args
use std::process; // for process::exit
use minigrep::Config;

/*
设置环境变量 不区分大小写
CASE_INSENSITIVE=1  cargo  run XXX test.txt 
*/

fn main() {
    let args: Vec<String> = env::args().collect();

    let config = Config::new(&args).unwrap_or_else(|error|{
        eprintln!("Problem parsing arguments: {}", error);
        process::exit(1);
    });

    if let Err(e) =  minigrep::run(config){
        eprintln!("Application error: {}", e);
        process::exit(1);
    }
}

